package net.gqu.main;


import java.net.UnknownHostException;

import com.mongodb.Mongo;
import com.mongodb.MongoException;

/**
 * Basically ,we will provide a mongodb instance for each Application. 
 * @author Administrator
 */
public class MongoDBProvider {

	public static String DB_MAIN = "MainDB";
	
	private static Mongo mongo = null;
	
	public static Mongo getMongo() {
		return mongo;
	}
	
	public static void init(String ip, int port) {
		if (mongo==null) {
			try {
				mongo = new Mongo(ip, port);
			} catch (UnknownHostException e) {
				e.printStackTrace();
			} catch (MongoException e) {
				e.printStackTrace();
			}
		}
	}
	
}
